package com.cjl.annotation;

import java.lang.annotation.Annotation;

@AnnotationSource("source")
@AnnotationClass("class")
@AnnotationRuntime("runtime")
public class CompareRetentionPolicy {
    public static void main(String[] args) {
        CompareRetentionPolicy compareRetentionPolicy = new CompareRetentionPolicy();
        try {
            Class clazz = Class.forName("com.cjl.annotation.CompareRetentionPolicy");
            System.out.println("CompareRetentionPolicy.main "+clazz.getAnnotation(AnnotationSource.class));
            System.out.println("CompareRetentionPolicy.main "+clazz.getAnnotation(AnnotationClass.class));
            System.out.println("CompareRetentionPolicy.main "+clazz.getAnnotation(AnnotationRuntime.class));
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        System.out.println("CompareRetentionPolicy.main--------------------");
        for (Annotation annotation : compareRetentionPolicy.getClass().getAnnotations()) {
            System.out.println("CompareRetentionPolicy.main annotation "+annotation);
        }
    }
}
